<?php
header('content-type:text/html; charset=utf-8');
$name=$_REQUEST['name'];
$phone=$_REQUEST['phone'];
$qq=$_REQUEST['qq'];

$pdo= new PDO('mysql:dbname=p1;charset=utf8;','root');
$sql=$pdo->prepare('insert into p2 (name,phone,qq)  values(:name,:phone,:qq)');
if($sql->execute(array('name'=>$name,'phone'=>$phone,'qq'=>$qq))){
	echo "添加成功";
}else{
	echo "添加失败";
}
header('Refresh:2;url=index.php');
die('<h3>添加成功</h3><a herf="/index.php>点击可访问</a>');
//  $pdo= new PDO('mysql:dbname=p1','root');
//  $stat =$pdo->prepare('select * from p2');
//  $stat->execute();
//  $data = $stat->fetchAll();
//  var_dump($data);
//  @$age= $_REQUEST['p2'];
 